﻿using LearnTower.Business.Concrete;
using LearnTower.Business.Contract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Text;
using System.Threading.Tasks;

namespace LearnTower.Business.ConsoleHost
{
    class Program
    {
        static void Main(string[] args)
        {
            // Step 1 Create a URI to serve as the base address.
            //Uri baseAddress = new Uri("http://localhost:8090/Service/");

            // Step 2 Create a ServiceHost instance
            ServiceHost selfHost = new ServiceHost(typeof(AuthenticationService));

            //try
            //{
                // Step 3 Add a service endpoint.
                //selfHost.AddServiceEndpoint(typeof(IAuthenticationService), new WSHttpBinding(), "AuthenticationService");

                // Step 4 Enable metadata exchange.
                //ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                //smb.HttpGetEnabled = true;
                //selfHost.Description.Behaviors.Add(smb);

                // Step 5 Start the service.
                selfHost.Open();
                Console.WriteLine("The service is ready.");
                Console.WriteLine("Press <ENTER> to terminate service.");
                Console.WriteLine();
                Console.ReadLine();

                // Close the ServiceHostBase to shutdown the service.
                Console.WriteLine("Service closing...");
                selfHost.Close();
            //}
            //catch (CommunicationException ce)
            //{
            //    Console.WriteLine("An exception occurred: {0}", ce.Message);
            //    selfHost.Abort();
            //}

        }
    }
}
